package com.dk.service.Impl;

import com.dk.mapper.EmpMapper;
import com.dk.pojo.Emp;
import com.dk.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmpServiceImpl implements EmpService {
    @Autowired
    private EmpMapper em;

    @Override
    public List<Emp> getEmp() {
        return em.selectByExample(null);
    }

    @Override
    public int addEmp(Emp e) {
        return em.insertSelective(e);
    }

    @Override
    public int deleteEmp(Integer id) {
        return em.deleteByPrimaryKey(id);
    }

    @Override
    public Object getById(Integer id) {
        return em.selectByPrimaryKey(id);
    }

    @Override
    public int updateEmp(Emp e) {
        return em.updateByPrimaryKey(e);
    }
}
